Skip to content

fix: align native libraries to 16 KB page boundaries for Android 15+ - #74

Open
verlyn13 wants to merge 1 commit into
alexey-pelykh:mainfrom
verlyn13:fix/16kb-page-alignment-upstream
Open

fix: align native libraries to 16 KB page boundaries for Android 15+#74
verlyn13 wants to merge 1 commit into
alexey-pelykh:mainfrom
verlyn13:fix/16kb-page-alignment-upstream

Conversation

@verlyn13

Copy link
Copy Markdown

Problem

Android 15 introduces support for 16 KB page sizes. Devices using 16 KB pages cannot load native libraries that have ELF LOAD segments not aligned to 16 KB boundaries.

Currently, all four native libraries produce alignment warnings:

  • libUVCCamera.so
  • libjpeg-turbo1500.so
  • libusb100.so
  • libuvc.so

Solution

Add APP_LDFLAGS := -Wl,-z,max-page-size=16384 to Application.mk, which applies the 16 KB alignment to all native libraries at link time.

Verification

After this change, all LOAD segments in the built libraries show Align: 0x4000 (16384 bytes).

References

Android 15+ devices may use 16 KB page sizes. Native libraries with
LOAD segments not aligned to 16 KB boundaries will fail to load on
these devices.

Add APP_LDFLAGS with -Wl,-z,max-page-size=16384 to ensure all native
libraries (libUVCCamera, libjpeg-turbo1500, libusb100, libuvc) are
built with proper alignment.

See: https://developer.android.com/guide/practices/page-sizes

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant